<HTML><HEAD>
<!--
    ---------------------
    Window Remote Creator
    ---------------------
-->

<SCRIPT LANGUAGE="JavaScript"><!-- hide from old browsers

/*
    THE JAVASCRIPT COOKBOOK by Erica Sadun, webrx@mindspring.com
    Copyright (c)2000 by Charles River Media.  All Rights Reserved.
    
    This applet can only be re-used or modifed by license holders of the
    JavaScript Cookbook CD-ROM.  Credit must be given in the source
    code and this copyright notice must be maintained. If you do
    not hold a license to the JavaScript Cookbook, you may NOT
    duplicate or modify this code for your own use.

    Use at your own risk. No warranty is given or implied of the suitability 
    of this applet for any specific application. Neither Erica Sadun nor 
    Charles River Media will be held responsible for any unwanted effects 
    due to the use of this applet or any derivative. 
*/

// Create and pop up a small window
function PopIt()
{
  popup = window.open("CONTROL2.HTM","popDialog2",
      "height=120,width=200,scrollbars=no")
      
  // repeat for Macs
  popup = window.open("CONTROL2.HTM","popDialog2",
      "height=120,width=200,scrollbars=no")
      
}
<!-- done hiding --></SCRIPT></HEAD>

<BODY bgcolor="ffffff" link="0000ff" vlink="770077">
    
<FONT COLOR="007777"><H1><IMG SRC="../GRAFX/SPICE.JPG" WIDTH=37 HEIGHT=72
ALIGN = LEFT>Frames Remote Control</H1></FONT>
<BLOCKQUOTE><FONT SIZE=4>
    This script creates a small remote control that lets you pick
    a frame, reload it or move back and forward through its history.
    <FORM><INPUT TYPE="BUTTON" VALUE="Start Remote" onClick="PopIt()">
    </FORM>
</FONT></BLOCKQUOTE>


<br><br>
<FONT COLOR="007777"><H2>Discussion</H2></FONT>
<FONT SIZE=4>
Unlike the window remote control, this remote lets the reader
select which window to manipulate. The selection list is
created automatically by recursive descent of the frames tree.
The window to manipulate is built up from the remote's 
<FONT COLOR="770000">opener</FONT> pointer and the
selected text.
<p>
</FONT>

<FONT COLOR="770000"><PRE>
// Create the options for the frame selection
function recurseFrames(aFrame, path)
{
    var which = aFrame.name
    
    if (which != "")
        document.writeln("<OPTION>"+path+'.'+which)
    else
        document.writeln("<OPTION>[window]")
    
    // recurse the children
    for (var i = 0; i < aFrame.frames.length; i++)
        recurseFrames(aFrame.frames[i], path+which)
}

// Create the selection list
function createSelect()
{
    document.writeln('&lt;FORM&gt;&lt;SELECT NAME="frames" SIZE="1"&gt;')
    recurseFrames(self.opener.top, "")
    document.writeln('&lt;/SELECT&gt;&lt;/FORM&gt;')
}
</PRE></FONT>
<h5>Copyright &copy;1996 by Charles River Media, All Rights Reserved</h5>
</BODY>
</HTML>